//单重for + indexOf
let arr = [1, 2, 2, 5, 8, 8, 2, 9]
function unique(arr) {
    let array = [arr[0]]
    for (let i = 0; i < arr.length; i++) {
        if(array.indexOf(arr[i])=== -1) {
            array.push(arr[i])
        }
    }
    console.log(array);
}
unique(arr)